import { List } from 'immutable';
import Field from './Field';

export function listCreatorFactory(creator) {
  return list => {
    if (List.isList(list) || Array.isArray(list)) {
      return List(list.map(creator));
    }
  };
}
export function createFieldList(list = []) {
  return listCreatorFactory(Field.create)(list);
}
